<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['异常警报','设备关机警报']" icon="fa fa-exclamation-circle" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>设备关机警报</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<sa-company-tree-car companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree-car>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">异常类型</span>
									<select name="" class="top_module_select" [(ngModel)]="abnormalType" style="min-width: 120px;">
										<option value="">全部</option>
										<option value="1">离线警报</option>
										<option value="2">断电警报</option>
										<option value="3">异常断电</option>
									</select>
								</div>
								
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">时长大于[秒]</span>
									<input class="module_inp" type="text" [(ngModel)]="totalSecond" style="padding: 0 12px;" placeholder="请输入"/>
								</div>
								<div class="selectDate top_module">
									<div class="input-daterange input-group s_selected_time_box s_hover_box">
										<input type="text" [(ngModel)]='startTime' class="form-control s_selected_time" id="datetimepicker1"  autocomplete="off" placeholder="选择开始时间"/>
										<span class="s_selected_time_spe">至</span>
										<input type="text" [(ngModel)]='endTime' class="form-control s_selected_time" id="datetimepicker2"  autocomplete="off" placeholder="选择结束时间"/>
										<div class="s_del_icon" (click)='del_date()'>x</div>
									</div>
								</div>
								<button type="button" class="btn btn-primary" (click)="table_search()">查询</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="车牌,设备ID...">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<!--<th style="width: 55px;"><input type="checkbox" (change)="selectFn()" /></th>-->
										<th>设备ID</th>
										<th>车牌号</th>
										<th>所属公司</th>
										<th>异常信息</th>
										<th>关机时长</th>
										<th>关机时间</th>
										<th>开机时间</th>
										<th>地址</th>
										<th>状态</th>
										<th>处理意见</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i"  [ngClass]="{selected:activeSelected === row.id}" >
										<!--<td><input type="checkbox" (change)="onCheckboxChangeFn(row.id)" /></td>-->
										<td>{{row.deviceId}}</td>
										<td>{{row.carNumber}}</td>
										<td>{{row.companyName}}</td>
										<td>{{row.message}}</td>
										<td>
											<!--{{row.totalSecond}}-{{row.type}}-->
											<span *ngIf="row.type == 1" >
												<span *ngIf="!row.onTime||row.totalSecond =='0秒'" >离线中</span>
												<span *ngIf="row.totalSecond&&row.onTime" >{{row.totalSecond}}</span>
											</span>
											<span *ngIf="row.type == 2" >
												<span *ngIf="!row.onTime||row.totalSecond =='0秒'" >断电中</span>
												<span *ngIf="row.totalSecond&&row.onTime" >{{row.totalSecond}}</span>
											</span>
											<span *ngIf="row.type == 3" >
												<span *ngIf="!row.onTime||row.totalSecond =='0秒'" >无</span>
												<span *ngIf="row.onTime&&row.totalSecond" >{{row.onTime}}</span>
											</span>	
										</td>
										<td>{{row.offTime}}</td>
										<td>
											<span *ngIf="row.type == 1" >
												<span *ngIf="!row.onTime||row.totalSecond =='0秒'" >离线中</span>
												<span *ngIf="row.onTime&&row.totalSecond" >{{row.onTime}}</span>
											</span>
											<span *ngIf="row.type == 2" >
												<span *ngIf="!row.onTime||row.totalSecond =='0秒'" >断电中</span>
												<span *ngIf="row.onTime&&row.totalSecond" >{{row.onTime}}</span>
											</span>
											<span *ngIf="row.type == 3">
												<span *ngIf="!row.onTime||row.totalSecond =='0秒'" >无</span>
												<span *ngIf="row.onTime&&row.totalSecond" >{{row.onTime}}</span>
											</span>
										
										</td>
										<td>{{row.address}}</td>
										<td>
											<span *ngIf="row.handleStatus == 0" class="orange">未处理</span>
											<span *ngIf="row.handleStatus == 1" class="green">已处理</span>
										</td>
										<td>{{row.addvice}}</td>
										<td>
											<button type="button" (click)="dealMsg(row,dealModal)" >处理</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!--异常处理 弹窗-->
	<section bsModal #dealModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" aria-label="Close" (click)="cancelDeal(dealModal)"><span aria-hidden="true">&times;</span></button>     
					<h4 class="modal-title">异常处理</h4>
				</div>
				<div class="modal-body">
					<textarea class="handleInfo form-control" [(ngModel)]="advise"  cols="30" rows="4" placeholder="处理意见或留言"></textarea>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="cancelDeal(dealModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="dealSubmit(dealModal)">确认</button>
				</div>
			</div>
		</div>
	</section>
	<!--异常处理 弹窗-->
</div>
